/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bgu.sonar.util.collections;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author User
 */
public class ImmutableMapView<K, V> implements Map<K, V> {

    private Map<K, V> wrapee;

    public ImmutableMapView(Map<K, V> wrapee) {
        this.wrapee = wrapee;
    }

    @Override
    public int size() {
        return wrapee.size();
    }

    @Override
    public boolean isEmpty() {
        return wrapee.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return wrapee.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return wrapee.containsValue(value);
    }

    @Override
    public V get(Object key) {
        return wrapee.get(key);
    }

    @Override
    public V put(K key, V value) {
        throw new UnsupportedOperationException("Not Supported.");
    }

    @Override
    public V remove(Object key) {
        throw new UnsupportedOperationException("Not Supported.");
    }

    @Override
    public void putAll(Map<? extends K, ? extends V> m) {
        throw new UnsupportedOperationException("Not Supported.");
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException("Not Supported.");
    }

    @Override
    public Set<K> keySet() {
        return new ImmutableSetView<>(wrapee.keySet());
    }

    @Override
    public Collection<V> values() {
        return new ImmutableCollectionView<>(wrapee.values());
    }

    @Override
    public Set<Entry<K, V>> entrySet() {
        return new ImmutableSetView<>(wrapee.entrySet());
    }

    @Override
    public boolean equals(Object o) {
        return wrapee.equals(o);
    }

    @Override
    public int hashCode() {
        return wrapee.hashCode();
    }
}
